//
//  NHTRouterMacro.swift
//  TestIos
//
//  Created by liyadong on 2025/11/12.
//  Copyright © 2025 Liyadong. All rights reserved.
//

import Foundation


public let NHTRouterParameterURL = "NHTRouterParameterURL"
public let NHTRouterParameterCompletion = "NHTRouterParameterCompletion"
public let NHTRouterParameterUserInfo = "NHTRouterParameterUserInfo"

let NHT_ROUTER_WILDCARD_CHARACTER = "~"
let specialCharacters = "/?&."

/**
 *  routerParameters 里内置的几个参数会用到上面定义的 string
 */
public typealias NHTRouterHandler = (_ routerParameters: [String: Any]?) -> Void

/**
 *  需要返回一个 object，配合 objectForURL: 使用
 */
public typealias NHTRouterObjectHandler = (_ routerParameters: [String: Any]?) -> Any?



// MARK: - 路由 URL Pattern 定义

/// 路由 URL Pattern 常量
public struct NHTRouterURL {
    /// 设置页面
    public static let settings = "nht://settings"
    
    /// 用户详情页 - 带 userId 参数
    public static let userDetail = "nht://user/:userId"
    
    /// 商品详情页 - 带 productId 和 category 参数
    public static let productDetail = "nht://product/:productId/:category"
    
    /// 搜索页面 - 带 Query 参数
    public static let search = "nht://search"
    
    /// 用户 API - 返回用户对象
    public static let apiUser = "nht://api/user/:userId"
    
    /// 通配符路由
    public static let wildcard = "nht://wildcard/~"
}
